package com.broadengate.bean;

import java.util.List;

public class DepartmentInfo  implements java.io.Serializable
{
    public int departmentId;
    
    public String departmentName;
    
    public int parentId;
    
    public String haschild;
    
    public String head;
    
    public List<DepartmentInfo> children;

    public int getDepartmentId()
    {
        return departmentId;
    }

    public void setDepartmentId(int departmentId)
    {
        this.departmentId = departmentId;
    }

    public String getDepartmentName()
    {
        return departmentName;
    }

    public void setDepartmentName(String departmentName)
    {
        this.departmentName = departmentName;
    }

    public int getParentId()
    {
        return parentId;
    }

    public void setParentId(int parentId)
    {
        this.parentId = parentId;
    }

    public String getHaschild()
    {
        return haschild;
    }

    public void setHaschild(String haschild)
    {
        this.haschild = haschild;
    }

    public String getHead()
    {
        return head;
    }

    public void setHead(String head)
    {
        this.head = head;
    }

    public List<DepartmentInfo> getChildren()
    {
        return children;
    }

    public void setChildren(List<DepartmentInfo> children)
    {
        this.children = children;
    }
    
    /**
     * 根据部门ID获取对应的部门信息
     * @param info
     * @param departmentId
     * @return [参数说明]
     * 
     * @return DepartmentInfo [返回类型说明]
     * @exception throws [违例类型] [违例说明]
     * @see [类、类#方法、类#成员]
     */
    public DepartmentInfo getDepartmentInfoById(DepartmentInfo info,int departmentId)
    {
        DepartmentInfo result = new DepartmentInfo();
        if(departmentId == this.getDepartmentId())
        {
            result= info;
            return result;
        }else
        {
            for (DepartmentInfo departmentInfo : this.getChildren())
            {
                if(departmentInfo.getDepartmentId()==departmentId)
                {
                    result= departmentInfo;
                    return result;
                }else
                {
                    departmentInfo.getDepartmentInfoById(departmentInfo, departmentId);
                }
            }
        }
        return result;
    }
}
